import 'package:rjpb/utils/http_util.dart';
import 'package:rjpb/config/config.dart';
import 'package:rjpb/routes/z.dart';

class LogoutApi {
  static Future<Map<String, dynamic>?> logout() async {
    final url = "$baseUrl/auth/logout";
    try {
      final response = await HttpUtil().delete(url);
      if (response?["code"] == 200) {
        return response;
      } else {
        Z.toast(response?['msg'] ?? 'error');
      }
    } catch (e) {
      print("退出登录接口请求失败: $e");
    }
  }

  static Future<Map<String, dynamic>?> getUserInfo() async {
    final url = "$baseUrl/system/user/getInfo";
    try {
      final response = await HttpUtil().get(url);
      if (response?["code"] == 200) {
        return response;
      } else {
        Z.toast(response?['msg'] ?? '获取用户信息失败');
      }
    } catch (e) {
      print("获取用户信息接口请求失败: $e");
    }
  }
}
